package com.hziee.cosmanage.companymanage.controller;

import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.hziee.cosmanage.companymanage.entity.InviteEntity;
import com.hziee.cosmanage.companymanage.service.InviteService;
import com.hziee.common.utils.PageUtils;
import com.hziee.common.utils.R;


/**
 * 企业招聘表
 *
 * @author yb
 * @email yangbin@gmail.com
 * @date 2021-02-04 14:28:16
 */
@RestController
@RequestMapping("companymanage/invite")
public class InviteController {
    @Autowired
    private InviteService inviteService;

    /**
     * 通过招聘需求请求
     *
     * @param cId
     * @param inviteId
     * @return
     */
    @GetMapping("/accessInvite/{cId}/{inviteId}")
    public R accessInvite(@PathVariable("cId") Integer cId, @PathVariable("inviteId") Integer inviteId) {
        inviteService.accessInvite(cId, inviteId);
        return R.ok();
    }

    @PostMapping("/upInviteRequire")
    public R upInviteRequire(@RequestBody List<InviteEntity> entities) throws IOException {
        int i = inviteService.upInviteRequire(entities);
        if (i == 1) {
            return R.ok("招聘信息发布成功");
        } else {
            return R.error("失败");
        }
    }
//    /**
//     * 列表
//     */
//    @RequestMapping("/list")
//    //@RequiresPermissions("companymanage:invite:list")
//    public R list(@RequestParam Map<String, Object> params){
//        PageUtils page = inviteService.queryPage(params);
//
//        return R.ok().put("page", page);
//    }
//
//
//    /**
//     * 信息
//     */
//    @RequestMapping("/info/{companyInviteId}")
//    //@RequiresPermissions("companymanage:invite:info")
//    public R info(@PathVariable("companyInviteId") Integer companyInviteId){
//		InviteEntity invite = inviteService.getById(companyInviteId);
//
//        return R.ok().put("invite", invite);
//    }
//
//    /**
//     * 保存
//     */
//    @RequestMapping("/save")
//    //@RequiresPermissions("companymanage:invite:save")
//    public R save(@RequestBody InviteEntity invite){
//		inviteService.save(invite);
//
//        return R.ok();
//    }
//
//    /**
//     * 修改
//     */
//    @RequestMapping("/update")
//   // @RequiresPermissions("companymanage:invite:update")
//    public R update(@RequestBody InviteEntity invite){
//		inviteService.updateById(invite);
//
//        return R.ok();
//    }
//
//    /**
//     * 删除
//     */
//    @RequestMapping("/delete")
//    //@RequiresPermissions("companymanage:invite:delete")
//    public R delete(@RequestBody Integer[] companyInviteIds){
//		inviteService.removeByIds(Arrays.asList(companyInviteIds));
//
//        return R.ok();
//    }

}
